package main

import (
	"encoding/json"
	"fmt"
)

// User 用户信息
type User struct {
	Id   int
	Name string
	Age  int
	UserExt
}

// UserExt 用户扩展信息
type UserExt struct {
	Habit string
}

func main() {
	user := User{
		Id:   1,
		Name: "测试",
		Age:  1,
		UserExt: UserExt{
			Habit: "习惯",
		},
	}
	marshal, _ := json.Marshal(user)
	fmt.Printf("%s", marshal)
}
